/**
 * @filename:OperLogServiceImpl 2022-2-21
 * @project Wonder Java前后台分离框架  1.1.0
 * Copyright(c) 2022 Wonder Co. Ltd. 
 * All right reserved. 
 */
package com.wonder.admin.service.impl;

import com.wonder.admin.domain.OperLog;
import com.wonder.admin.mapper.OperLogDao;
import com.wonder.admin.service.OperLogService;
import com.wonder.admin.request.OperLogRequest;
import com.wonder.common.utils.StringUtils;
import com.wonder.common.common.AjaxMap;
import java.util.Map;
import java.util.HashMap;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.Date;

/**   
 * @Description:TODO(操作日志服务实现)
 *
 * @version: 1.1.0
 * @author: Wonder
 * 
 */
@Service
public class OperLogServiceImpl  extends ServiceImpl<OperLogDao, OperLog> implements OperLogService  {

    /**
     * 验证操作日志信息
     * 
     * @param OperLog信息
     * @return 结果
     */
    @Override
    public String validate(OperLog operLog){
    
    
       return "";
    }
    
    /**
	 * Description:操作日志分页返回
	 * @request:检索条件
	 * @page：分页参数
	 * @return:分页记录
	 */
	@Override 
	public IPage<OperLog> selectList(OperLogRequest request, Page<OperLog> page){
	    LambdaQueryWrapper<OperLog> lambdaQueryWrapper = new LambdaQueryWrapper<>();
	    
	    if (null != request.getOper_id()) {
	       lambdaQueryWrapper.eq(OperLog::getOper_id, request.getOper_id());
	      }               
             
	    if (null != request.getBusiness_type()) {
	       lambdaQueryWrapper.eq(OperLog::getBusiness_type, request.getBusiness_type());
	      }               
             
	    if (null != request.getOperator_type()) {
	       lambdaQueryWrapper.eq(OperLog::getOperator_type, request.getOperator_type());
	      }               
             
	    if (null != request.getUser_id()) {
	       lambdaQueryWrapper.eq(OperLog::getUser_id, request.getUser_id());
	      }               
             
        if (request.getCreate_time() != null){
        	Date[] create_time=request.getCreate_time();
        	if(create_time.length>0)
        	  lambdaQueryWrapper.ge(OperLog::getCreate_time, create_time[0]); 
        	if(create_time.length==2)
        	  lambdaQueryWrapper.le(OperLog::getCreate_time,create_time[1]);      
        	
        }    
             
        
		lambdaQueryWrapper.orderByDesc(OperLog::getOper_id);	
		Page<OperLog> selectPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);

		return selectPage;
    }
        
    
	
}